<template>
	<view class="col-center-horizotal">
		<view class="item" v-for="item,index in list" @click="goItem(item)" :key="index">
			<image class="img" :src="item.list_image" mode="aspectFit">
			</image>
			<view class="title singe-line" style="margin-top: 40rpx;">
				{{item.name}}
			</view>
			<view class="row-between-center" style="margin-top: 40rpx;">
				<view class="sign row-center" @click.stop="getInfo(item)">
					报名信息
				</view>
					<view class="row-center" :class="item.end_image?'list':'list2' " @click.stop="goResult(item)">
					获奖名单
				</view>
			</view>
		</view>
		<view style="height: 220rpx;"></view>
		<TabBar ref="mySon" :currentItem2="1"></TabBar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				list:[]
			}
		},
		onPullDownRefresh() {
			this.page = 1
			this.getData()
		},
		onReachBottom() {
			this.getData()
		},
		onLoad() {
			this.getData()
		},
		onShow() {
		},
		methods:{
			goResult(item){
				if(item.end_image){
					uni.navigateTo({
						url:'/src/pages/index/result?img='+item.end_image
					})
				}else{
					uni.showToast({
						title:'还没有获奖名单',
						icon:'none'
					})
				}
				
			},
			async getData() {
				var res = await this.$req({
					url:'api/activities/my_sign_log_list',
					data:{
						page:this.page,
						limit:10,
					}
				})
				uni.stopPullDownRefresh()
				if(res.code == 1) {
					if(this.page ==1){
						this.list=[]
					}
					this.list=this.list.concat(res.data.data)
					console.log(this.list)
				}else{
					uni.showToast({
						title:res.msg,
						icon:'none'
					})
				}
			},
			async getInfo(item) {
				var res = await this.$req({
					url: 'api/activities/my_sign_log_info',
					data:{
						sign_id:item.sign_id
					}
				})
				if (res.code == 1) {
					uni.navigateTo({
						url:'/src/pages/index/submitPerson?id='+item.id+'&type='+item.sign_type+'&sign_id='+item.sign_id
					})
				} else {}
			},
			goItem(item){
				if(item.need_select_group==2){
						uni.navigateTo({
							url:'/src/pages/index/submitPerson?id='+item.id+'&type='+item.sign_type
						})
				}else{
					uni.navigateTo({
						url:'/src/pages/index/sign?id='+item.id
					})
				}
				
				uni.navigateTo({
					url:'/src/pages/index/info?id='+item.id+'&sign_id='+item.sign_id
				})
			}
		}
	}
</script>
<style>
	page{
		background: #FCE5E5;
	}
</style>
<style scoped lang="scss">
	.item{
		margin-top: 30rpx;
		width: 690rpx;
		height: 618rpx;
		background: #FFEFF3;
		box-shadow: 0rpx 8rpx 32rpx 0rpx rgba(255,84,132,0.2);
		border-radius: 48rpx ;
		padding: 30rpx;
		.img{
			width: 630rpx;
			height: 340rpx;
			box-shadow: 0rpx 8rpx 24rpx 0rpx rgba(102,35,6,0.2);
			border-radius: 24rpx ;
		}
		.title{
			font-weight: 600;
			font-size: 32rpx;
			color: #BF788D;
			line-height: 48rpx;
		}
		.sign{
			
			
			width: 300rpx;
			height: 88rpx;
			background:  linear-gradient( 180deg, #B0CEFF 0%, #5D99FF 100%);
			border-radius: 20rpx;
			font-weight: 600;
			font-size: 32rpx;
			color: #FFFFFF;
			line-height: 48rpx;
			
		}
		.list{
			width: 300rpx;
			height: 88rpx;
			background: linear-gradient( 180deg, #FE92BF 0%, #FF5377 100%);
			border-radius: 20rpx ;
			font-weight: 600;
			font-size: 32rpx;
			color: #FFFFFF;
			line-height: 48rpx;
		}
		.list2{
			width: 300rpx;
			height: 88rpx;
			background: #808281;
			border-radius: 20rpx ;
			font-weight: 600;
			font-size: 32rpx;
			color: #FFFFFF;
			line-height: 48rpx;
		}
	}
</style>
